/**
 */
package usixmlcui.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import usixmlcui.ConcreteGraphicalElementaryIU;
import usixmlcui.ListBox;
import usixmlcui.ListItem;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>List Box</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.ListBoxImpl#getNumberVisableLines <em>Number Visable Lines</em>}</li>
 *   <li>{@link usixmlcui.impl.ListBoxImpl#getEReference0 <em>EReference0</em>}</li>
 *   <li>{@link usixmlcui.impl.ListBoxImpl#getEReference1 <em>EReference1</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ListBoxImpl extends EObjectImpl implements ListBox {
	/**
	 * The default value of the '{@link #getNumberVisableLines() <em>Number Visable Lines</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberVisableLines()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_VISABLE_LINES_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberVisableLines() <em>Number Visable Lines</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberVisableLines()
	 * @generated
	 * @ordered
	 */
	protected int numberVisableLines = NUMBER_VISABLE_LINES_EDEFAULT;

	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected ListItem eReference0;

	/**
	 * The cached value of the '{@link #getEReference1() <em>EReference1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference1()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalElementaryIU eReference1;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ListBoxImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.LIST_BOX;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberVisableLines() {
		return numberVisableLines;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberVisableLines(int newNumberVisableLines) {
		int oldNumberVisableLines = numberVisableLines;
		numberVisableLines = newNumberVisableLines;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LIST_BOX__NUMBER_VISABLE_LINES, oldNumberVisableLines, numberVisableLines));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ListItem getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (ListItem)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.LIST_BOX__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ListItem basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(ListItem newEReference0) {
		ListItem oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LIST_BOX__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalElementaryIU getEReference1() {
		if (eReference1 != null && eReference1.eIsProxy()) {
			InternalEObject oldEReference1 = (InternalEObject)eReference1;
			eReference1 = (ConcreteGraphicalElementaryIU)eResolveProxy(oldEReference1);
			if (eReference1 != oldEReference1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.LIST_BOX__EREFERENCE1, oldEReference1, eReference1));
			}
		}
		return eReference1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalElementaryIU basicGetEReference1() {
		return eReference1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference1(ConcreteGraphicalElementaryIU newEReference1) {
		ConcreteGraphicalElementaryIU oldEReference1 = eReference1;
		eReference1 = newEReference1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LIST_BOX__EREFERENCE1, oldEReference1, eReference1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.LIST_BOX__NUMBER_VISABLE_LINES:
				return new Integer(getNumberVisableLines());
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE1:
				if (resolve) return getEReference1();
				return basicGetEReference1();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.LIST_BOX__NUMBER_VISABLE_LINES:
				setNumberVisableLines(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE0:
				setEReference0((ListItem)newValue);
				return;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE1:
				setEReference1((ConcreteGraphicalElementaryIU)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.LIST_BOX__NUMBER_VISABLE_LINES:
				setNumberVisableLines(NUMBER_VISABLE_LINES_EDEFAULT);
				return;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE0:
				setEReference0((ListItem)null);
				return;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE1:
				setEReference1((ConcreteGraphicalElementaryIU)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.LIST_BOX__NUMBER_VISABLE_LINES:
				return numberVisableLines != NUMBER_VISABLE_LINES_EDEFAULT;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE0:
				return eReference0 != null;
			case Usixml_cuiPackage.LIST_BOX__EREFERENCE1:
				return eReference1 != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (numberVisableLines: ");
		result.append(numberVisableLines);
		result.append(')');
		return result.toString();
	}

} //ListBoxImpl
